package base.study.chapter9;

import org.junit.Test;

import java.util.ArrayDeque;
import java.util.Deque;
import java.util.LinkedList;
import java.util.PriorityQueue;

/**
 * 双端队列
 */
public class DequeDemo {

    public static void main(String[] args) {
        Deque<String> deque = new ArrayDeque<>(2);
        deque.addFirst("1");
        deque.addFirst("2");
        deque.addFirst("3");
        System.out.println(deque);
    }

    @Test
    public void testPriorityQueue(){
        PriorityQueue<Integer> priorityQueue = new PriorityQueue<>();
        priorityQueue.add(3);
        priorityQueue.add(2);
        priorityQueue.add(1);
        System.out.println(priorityQueue);

        while (!priorityQueue.isEmpty()){
            Integer poll = priorityQueue.poll();
            System.out.println(poll);
        }
    }
}
